<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="__CSS__/bootstrap.min.css" >
    <link rel="stylesheet" href="__STATIC__/layui/css/layui.css">
    <style>
        .title_box{
            width: 100%;
            height: 35px;
            font-size: 24px;
            color: #3c8dbc;
            text-indent: 10px;
            line-height: 35px;
            font-weight: bold;
            border-bottom: 1px solid #ccc;
            margin: 20px auto;
            text-align: center;
        }
    </style>
</head>
<body>
    <div class="title_box">短信发送</div>
    <div class="wrapper">
        <div class="panel-body">
            <form class="layui-form" action="{:url('sendmessage')}" method="post">
                <div class=" layui-form-item ">
                    <label  class="control-label col-lg-2">订单ID:</label>
                    <div class="col-lg-6">
                        <input class="form-control" type="text" value="{$info.id}" disabled>
                        <input class="form-control" type="hidden" name="id" value="{$info.id}">
                    </div>
                </div>
                <div class="layui-form-item ">
                    <label  class="control-label col-lg-2">顾客姓名:</label>
                    <div class="col-lg-6">
                        <input class="form-control"  value="{$info.name}" type="text"  disabled="disabled" />
                    </div>
                </div>
                <input type="hidden" name="hsdzid" value="{$info.hsdzid}">
                <div class=" layui-form-item ">
                    <label  class="control-label col-lg-2">会所状态:</label>
                    <div class="col-lg-6">
                        <select class="form-control" name="hdstate" lay-verify="required" lay-filter="hdstate">
                            <option value="">{$info.hszt_text}</option>
                            {volist name='hsstate' id='data'}
                            <option value="{$data.id}" {neq name='data.id' value='76'}disabled{/neq} >{$data.name}</option>
                            {/volist}
                        </select>
                    </div>
                </div>
                <div class=" layui-form-item "  lay-filter="yysktime">
                    <label  class="control-label col-lg-2">预约上课时间:</label>
                    <div class="col-lg-6">
                        <input type="text" class="form-control" name="yysktime"  lay-verify="required" onclick="laydate({min: laydate.now(), istime: true, format: 'YYYY-MM-DD hh:mm'})" {neq name="info.yysktime" value="1970-01-01 8:00"}value="{$info.yysktime}"{/neq}  >
                    </div>
                </div>
                <div class=" layui-form-item "  >
                    <label class="control-label col-lg-2">预约课程:</label>
                    <div class="col-lg-6">
                        <select class="form-control" name="kcid" lay-verify="required" lay-filter="yycg" id="yycg">
                            <option value="">请选择课程</option>
                            {volist name='kecheng' id='data'}
                            <option value="{$data.id}" {eq name="info.kcid" value="$data.id"}selected="selected"{/eq} >{$data.name}</option>
                            {/volist}
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn"  lay-filter="*" lay-submit id="submit">发送</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
    <script type="text/javascript" src="__JS__/jquery-2.2.3.min.js"></script>
    <script type="text/javascript" src="__STATIC__/layui/layui.js"></script>
    <script type="text/javascript" src="__STATIC__/laydate/laydate.js"></script>

    <script>
        layui.use(['jquery', 'form'], function(){
            var $ = layui.jquery, form = layui.form();

            form.on('submit(*)', function (data) {
                $.ajax({
                    url: data.form.action,
                    type: data.form.method,
                    data: $(data.form).serialize(),
                    beforeSend:function(){
                        $('#submit').attr("disabled","false"); //禁止点击
                    },
                    success: function (msg) {
//                        console.log(msg);

                        $('#submit').attr("disabled","false"); //禁止点击
                        layer.msg(msg.msg, {icon: msg.icon});
                        if(msg.status ==1 ){
                            setTimeout(function(){
                                parent.layer.closeAll();
                            },3000);
                        }else{
                            setTimeout(function(){
                                location.href=msg.url;
                                $('#submit').removeAttr("disabled"); //禁止点击
                            },3000);
                        }
                    }
                });
                return false;
            });

        });
    </script>
</body>
</html>